#ifndef _PartonDistribution_H_
#define _PartonDistribution_H_

//
// PartonDistribution.h
//
// Created by TB on 11/22/11.
// Copyright 2011 BNL. All rights reserved.
//

#include <string>

#include <Rtypes.h>
#include <TObject.h>

#include "tppmc/Enumerations.h" // For LHAPDF::Flavour if not defined
#include "tppmc/PartonContent.h"
#include "tppmc/Particle.h"

namespace tppmc {

   /**
    Abstract base class for a parton distribution functoin.
    */
   class PartonDistribution : public TObject {
      
   public:
      
      /**
       Destructor.
       */
      virtual ~PartonDistribution() { }


      /**
       Evaluate the distribution for a parton at a given scale.
       virtual double Evaluate(const pythpart&, double scale) const = 0;
       */
      virtual void Evaluate(const pythpart&,
                            double scale,
                            PartonContent&) const = 0;

      /**
       Any complex initialisation should occur here, not in the constructor.
       Particularly, do not call virtual functions in the constructor.
       Return 0 to indicate successful initialisation, non-zero for an error.
       \todo make pure virtual, implement in inheriting classes
      */
      virtual int Initialise() { return 0; }

      /**
       Returns true if the distribution of the input parton type
       is supported by this function.
       */
      virtual bool Supports(const pythpart&) const = 0;


      virtual std::string Name() const = 0;
      
      ClassDef(tppmc::PartonDistribution, 1) 
   };
   
   /**
    A distribution that always returns zero.
   */
   class NullDistribution : public PartonDistribution {
   public:
      NullDistribution() { }
      virtual ~NullDistribution() { }
      virtual void Evaluate(const pythpart&,
                            double,
                            PartonContent& p) const {
         p = PartonContent(0.);
      }
      virtual bool Supports(const pythpart&) const { return true; }
      virtual std::string Name() const { return "Null"; }
      
      ClassDef(tppmc::NullDistribution, 1) 
   };
}

#endif
